import request from "@/api/request";

// 获取全部灵感列表
export function getallinspiration() {
    return request({
        method: "GET",
        url: "api/h/inspirations/",
    });
}

// 根据id获取灵感详情
export function getinspirationDetails(id) {
    return request({
        method: "GET",
        url: "api/h/inspirations/" + id + "/",
    });
}

// 上传灵感全局方案
export function addglobals(data) {
    return request({
        headers: {
            'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
        },
        method: "POST",
        url: "api/h/inspirations/",
        data
    });
}

// 获取收藏
export function getfavorites() {
    return request({
        method: "GET",
        url: "api/h/favorites/styles/",
    });
}

// 收藏
export function getfavorite(id) {
    return request({
        method: "POST",
        url: "api/h/inspirations/"+ id + "/favorite/",
    });
}

// 取消收藏
export function delfavorite(id) {
    return request({
        method: "DELETE",
        url: "api/h/inspirations/"+ id + "/favorite/",
    });
}

// 获取我的灵感方案
export function getmyinspirations() {
    return request({
        method: "GET",
        url: "api/h/my/inspirations/",
    });
}

// 投票
export function getvoting(id) {
    return request({
        method: "POST",
        url: "api/h/inspirations/"+ id + "/voting/",
    });
}

// 取消投票
export function delvoting(id) {
    return request({
        method: "DELETE",
        url: "api/h/inspirations/"+ id + "/voting/",
    });
}


